package com.file.service.Impl;

import com.file.mapper.FileMapper;
import com.file.pojo.File;
import com.file.pojo.User;
import com.file.service.FileService;
import com.file.vo.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class FileServiceImpl implements FileService {
    @Autowired
    private FileMapper fileMapper;

    //分页查询文件信息
    @Override
    public PageResult<File> selectFile(int pageNum, int pageSize,String query) {
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("pageNum",(pageNum-1)*pageSize);
        params.put("pageSize",pageSize);
        PageResult<File> pageResult = new PageResult<>();
       // List<File> list = fileMapper.selectFilePage(params);
        List<File> listUser = fileMapper.selectFile(query);//条件查询
        pageResult.setRows(listUser);
        pageResult.setTotal((int) fileMapper.count());
        return pageResult;
    }
    //删除文件信息
    @Override
    public Integer deleteFileById(Integer id) {
        return fileMapper.deleteFile(id);
    }
}
